﻿$(document).ready(function () {

    loadContent($('.menuhor li a').attr('id'));

    $('.menuhor li').click(function () {
        $('.menuhor li').children('a').attr('class', '');
        $(this).children('a').attr('class', 'active');
        loadContent($(this).children('a').attr('id'));
    });

    function loadContent(cat) {
        var sContent = '';
        for (game in jsnGamesCat) {
            if (jsnGamesCat[game].cat == cat) {
                sContent += "<li><a href=\"/games/" + jsnGamesCat[game].id + "\" class=\"bdc5 item\">";
                sContent += "<img class=\"img bdc2\" src=\"http://www.otzee.com.br/images/games/000/000/" + jsnGamesCat[game].id + "/spotlight_normal.jpg\" alt=\"\">";
                sContent += "<strong class=\"clr5\">" + jsnGamesCat[game].name + "</strong>";
                sContent += "<span class=\"dtdesc\">" + jsnGamesCat[game].text + "</span>";
                sContent += "</a></li>";
            }
        }
        $('#ctl00_cphConteudo_ucCatGames_ulJogosCategoria').html(sContent);
    }
});